package database;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.Proxy;

@Entity
@Table(name = "t_world")
@Proxy(lazy = false)
public class MWorld {

	private int id;
	private List<MWorldObject> objectList = new ArrayList<MWorldObject>();
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@OneToMany(mappedBy = "worldReference", orphanRemoval=true )
	@LazyCollection(LazyCollectionOption.TRUE)
	@Cascade({org.hibernate.annotations.CascadeType.ALL})
	public List<MWorldObject> getObjectList() {
		return objectList;
	}
	public void setObjectList(List<MWorldObject> objectList) {
		this.objectList = objectList;
	}
	
	
	
	
}
